package cn.fatgod.learn.thymeleaf.ast.model;

import cn.fatgod.learn.thymeleaf.standard.enums.PermissionModifier;

public class FieldItem {

    /**
     * 权限修饰符
     */
    private final PermissionModifier modifier;

    /**
     * '
     * 类型
     */
    private final TypeItem type;

    /**
     * 字段名称
     */
    private final String name;

    /**
     * 参数
     */
    private final ArgItem arg;

    /**
     * 注释
     */
    private String comment;

    public static FieldItem create(TypeItem type, String name, ArgItem arg) {
        return new FieldItem(PermissionModifier.PRIVATE, type, name, arg);
    }

    public static FieldItem create(PermissionModifier modifier, TypeItem type, String name, ArgItem arg) {
        return new FieldItem(modifier, type, name, arg);
    }

    private FieldItem(PermissionModifier modifier, TypeItem type, String name, ArgItem arg) {
        this.modifier = modifier;
        this.type = type;
        this.name = name;
        this.arg = arg;
    }

    public PermissionModifier getModifier() {
        return modifier;
    }

    public TypeItem getType() {
        return type;
    }

    public String getName() {
        return name;
    }

    public ArgItem getArg() {
        return arg;
    }

    public String getComment() {
        return comment;
    }

    public FieldItem setComment(String comment) {
        this.comment = comment;
        return this;
    }
}
